clear
%% PROBLEM
Problem.Dimension = 3; % the dimension of the decision variable
Problem.LowerBound = [0,0,0]; % the lower bound of the decision variable
Problem.UpperBound = [10,10,10]; % the upper bound of the decision variable
Problem.NumObjFunc = 2; % the number of objective functons
Problem.ObjFunc = @(x)([mean(x,2),0-x(:,1)]);  % the objective function
%% ALGORITHM
Algorithm.PopulationSize = 50;  % the population size of the ga
% Algorithm.StopCriteria = [1,10000];  % stop when the budget is exhausted
Algorithm.StopCriteria = [2,200];  % stop when the number of generation is reached
% the followings are not necessary
% Algorithm.pc = 0.9;  % the crossover probability
% Algorithm.pm = 1/Problem.Dimension;  % the mutation probability
% Algorithmeta_c = 20;  % SBX index
% Algorithmeta_m =20;  % mutation index

[ParetoFront, ParetoSet, GenerationNum, EvaluationNum] = nsga2(Problem, Algorithm);
GenerationNum
EvaluationNum
%% FIGURES
figure()
hold on
rectangle('Position',[0,-10,10,10])
scatter(ParetoFront(:,1),ParetoFront(:,2),6,'filled')
hold off
